<%--
  Created by IntelliJ IDEA.
  User: aHao
  Date: 2020/10/28
  Time: 15:24
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head lang="zh-CN">
    <meta charset="UTF-8">
    <title>ssm_crud</title>
<%--    获取bootstrap框架--%>
    <jsp:include page="/WEB-INF/publicJsp/bootstrap.jsp"/>
</head>
<body>
<%--    内容容器--%>
    <div class="container">
<%--        标题行--%>
        <div class="row">
            <div class="col-lg-12">
                <h1>ssm_crud</h1>
            </div>
        </div>
<%--        按钮行--%>
        <div class="row">
            <div class="col-lg-4 col-lg-offset-8">
                <button class="btn btn-success"><span class="glyphicon glyphicon-plus" aria-hidden="true"/>新增</button>
                <button class="btn btn-danger"><span class="glyphicon glyphicon-remove" aria-hidden="true"/>删除</button>
            </div>
        </div>
<%--        数据表行--%>
        <div class="row">
            <table class="table table-hover">
                <thead>
                    <tr>
                        <td>#</td>
                        <td>name</td>
                        <td>gender</td>
                        <td>email</td>
                        <td>department</td>
                        <td>action</td>
                    </tr>
                </thead>
                <tbody>
                <c:forEach items="${pageInfo.list}" var="emp">
                    <tr>
                        <td>${emp.empId}</td>
                        <td>${emp.empName}</td>
                        <td>${emp.gender}</td>
                        <td>${emp.email}</td>
                        <td>${emp.department.deptName}</td>
                        <td>
                            <button class="btn btn-primary btn-small"><span class="glyphicon glyphicon-pencil" aria-hidden="true"/>修改</button>
                            <button class="btn btn-danger btn-small"><span class="glyphicon glyphicon-remove" aria-hidden="true"/>删除</button>
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </div>
<%--        数据信息行--%>
        <div class="row">
            <div class="col-lg-3 col-lg-offset-4">
                当前页：${pageInfo.pageNum} 总页数:${pageInfo.pages} 总数据量：${pageInfo.total}
            </div>
        </div>
<%--        分页按钮行    --%>
        <div class="row">
            <div class="col-lg-4 col-lg-offset-4">
                <nav aria-label="Page navigation">
                    <ul class="pagination">
                        <li class="${pageInfo.isFirstPage?"disabled":""}">
                            <a href="/ssm_crud/emps?pn=${pageInfo.firstPage}">首页</a>
                        <c:if test="${pageInfo.hasPreviousPage}">
                        <li>
                            <a href="/ssm_crud/emps?pn=${pageInfo.pageNum-1}" aria-label="Previous">
                                <span aria-hidden="true">&laquo;</span>
                            </a>
                        </li>
                        </c:if>
                        <c:forEach items="${pageInfo.navigatepageNums}" var="pageNum">
                        <li class="${pageInfo.pageNum==pageNum?"active":""}"><a href="/ssm_crud/emps?pn=${pageNum}">${pageNum}</a></li>
                        </c:forEach>
                        <c:if test="${pageInfo.hasNextPage}">
                        <li>
                            <a href="/ssm_crud/emps?pn=${pageInfo.pageNum+1}" aria-label="Next">
                                <span aria-hidden="true">&raquo;</span>
                            </a>
                        </li>
                        </c:if>
                        </li>
                        <li class="${pageInfo.isLastPage?"disabled":""}">
                            <a href="/ssm_crud/emps?pn=${pageInfo.lastPage}">尾页</a>
                        </li>
                    </ul>
                </nav>
            </div>
        </div>
    </div>
</body>
</html>
